How Do I Enable Error Handling in Java Report Engine?
The Java Report Engine API includes a facility for collecting and displaying warnings and errors that occur while it is generating output. This article describes what the verify and error handling features do, with some examples of the warnings and errors they capture.
This article also describes the API calls used to enable error handling, and provides example code based on one of our Catapult Java example command-line applications.
The relevant API calls are setTrackErrors() and GetErrorInfo().
#
How It WorksThe verify feature provides you with actionable information on non-fatal errors, warnings, and other issues contained within a Report Template that occur when generating output with Java Report Engine.
Error handling is a Tag property that can be set to catch errors and exceptions that occur in a Tag's query. Depending on the error-handling Tag property setting, otherwise fatal errors can be captured and ignored so output can be completed despite the error. For more details about the error-handling Tag property, see the Out Tag Reference. <!--- needs link to out tag reference>
#
Example Warnings and ErrorsHere are some examples of the warnings and errors captured when the verify and error handling features are used:
#
Data Type Issues#
Formatting Issues#
Bad Select Statement#
Node Does Not Exist#
Node Is Null#
Verification Issues#
setTrackErrors()setTrackErrors() is used to enable error handling in your Java Report Engine application:
#
setTrackErrors() FlagsHere are the values to which the setTrackErrors() flag argument can be set:
#
getErrorInfo()getErrorInfo() is used to process any warnings and errors that occur while Java Report Engine is running, after setTrackErrors() is used to turn on error handling:
getErrorInfo() is also a member of the net.windward.xmlreport.errorhandling.ErrorInfo class. Here is the ErrorInfo implementation:
To see these methods in action, check out our Java Engine samples on github. .